
clear all

*log using "R:\WSV2\TBu_BMa\Subsidies Project\Results\HU_Programs_Estimates_2023.smcl", replace


use "Estimation Sample.dta" 

set more off
set matsize 11000


preserve

********************************************************************************************************************************************************************************************************************
*************************************************HUNGARY************************************************************************************************************************************************************
*************************************************Washing Machine Program**2015**************************************************************************************************************************************
*************************************************Effects on Unit Sales and Prices of Subsidized and Non-subsidized**************************************************************************************************
********************************************************************************************************************************************************************************************************************

egen cmt	=	group(country month treath)
egen cy		=	group(country year)
egen cmlt=group(country month energy_label_eu treath)

tab energy_label_eu
encode energy_label_eu, gen(label)
encode country, gen(c)
keep if category=="washing machine"

 xtset id2


egen median=median(price) if year==2015 & treath==1 & month==8
gen mprice=1 if price>median & treath==1 & year==2015 & month==8 & price!=.
replace mprice=0 if price<=median & treath==1 & year==2015 & month==8 & price!=.
by id, sort: egen summp=sum(mprice)
by id, sort: gen medprice=1 if summp>0
replace medprice=0 if summp==0
drop median mprice summp 


egen median=median(price) if year==2015 & treath==1 & month==8 & energy_label_eu=="A+++"
gen mprice=1 if price>median & treath==1 & year==2015 & month==8 & price!=. & energy_label_eu=="A+++"
replace mprice=0 if price<=median & treath==1 & year==2015 & month==8 & price!=. & energy_label_eu=="A+++"
by id, sort: egen summp=sum(mprice)
by id, sort: gen medprice3=1 if summp>0
replace medprice3=0 if summp==0

*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
***UNIT SALES, SUBSIDIZED (3-MONTHS)

reghdfe dlogunits i.presub3h##ib1.treath i.presub2h##ib1.treath i.presub1h##ib1.treath i.sub1h##ib1.treath i.sub2h##ib1.treath i.sub3h##ib1.treath i.sub4h##ib1.treath i.postsub1h##ib1.treath i.postsub2h##ib1.treath i.postsub3h##ib1.treath mage mage2  if country!="Croatia", absorb(id2 cmt) cluster(id) 
est store subu
gen samples=e(sample)
		
		
		***Program, preshift and postshift effects 
		#delimit;
		nlcom 		(program:  	1/4*(exp(_b[1.presub2h])*exp(_b[1.presub1h])*exp(_b[1.sub1h])*(1+exp(_b[1.sub2h])+exp(_b[1.sub2h])*exp(_b[1.sub3h])+exp(_b[1.sub2h])*exp(_b[1.sub3h])*exp(_b[1.sub4h]))-4)) 
					(preshift: 	1/2*(exp(_b[1.presub1h])*(1+exp(_b[1.presub2h]))-2))
					(postshift:	1/2*(exp(_b[1.presub2h])*exp(_b[1.presub1h])*exp(_b[1.sub1h])*exp(_b[1.sub2h])*exp(_b[1.sub3h])*exp(_b[1.sub4h])*exp(_b[1.postsub1h])*(1+exp(_b[1.postsub2h]))-2)), post;			
		#delimit	cr		
		
		***Net program effect 
		nlcom 		_b[program] + (2/4)*_b[preshift]+ (2/4)*_b[postshift]
		
		
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
***UNIT SALES, SUBSIDIZED (CY-fe)
reghdfe dlogunits i.presub3h##ib1.treath i.presub2h##ib1.treath i.presub1h##ib1.treath i.sub1h##ib1.treath i.sub2h##ib1.treath i.sub3h##ib1.treath i.sub4h##ib1.treath i.postsub1h##ib1.treath i.postsub2h##ib1.treath i.postsub3h##ib1.treath mage mage2  if country!="Croatia", absorb(id2 cmt cy) cluster(id) 
est store subu_cy		
		

		***Program, preshift and postshift effects 
		#delimit;
		nlcom 		(program:  	1/4*(exp(_b[1.presub2h])*exp(_b[1.presub1h])*exp(_b[1.sub1h])*(1+exp(_b[1.sub2h])+exp(_b[1.sub2h])*exp(_b[1.sub3h])+exp(_b[1.sub2h])*exp(_b[1.sub3h])*exp(_b[1.sub4h]))-4)) 
					(preshift: 	1/2*(exp(_b[1.presub1h])*(1+exp(_b[1.presub2h]))-2))
					(postshift:	1/2*(exp(_b[1.presub2h])*exp(_b[1.presub1h])*exp(_b[1.sub1h])*exp(_b[1.sub2h])*exp(_b[1.sub3h])*exp(_b[1.sub4h])*exp(_b[1.postsub1h])*(1+exp(_b[1.postsub2h]))-2)), post;			
		#delimit	cr		
		
		***Net program effect 
		nlcom 		_b[program] + (2/4)*_b[preshift]+ (2/4)*_b[postshift]
		
		
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
***UNIT SALES, SUBSIDIZED (country-specific linear time trends)
reghdfe dlogunits i.presub3h##ib1.treath i.presub2h##ib1.treath i.presub1h##ib1.treath i.sub1h##ib1.treath i.sub2h##ib1.treath i.sub3h##ib1.treath i.sub4h##ib1.treath i.postsub1h##ib1.treath i.postsub2h##ib1.treath i.postsub3h##ib1.treath mage mage2  if country!="Croatia", absorb(id2 cmt i.c#c.date) cluster(id) 
est store subu_trends		
		

		***Program, preshift and postshift effects 
		#delimit;
		nlcom 		(program:  	1/4*(exp(_b[1.presub2h])*exp(_b[1.presub1h])*exp(_b[1.sub1h])*(1+exp(_b[1.sub2h])+exp(_b[1.sub2h])*exp(_b[1.sub3h])+exp(_b[1.sub2h])*exp(_b[1.sub3h])*exp(_b[1.sub4h]))-4)) 
					(preshift: 	1/2*(exp(_b[1.presub1h])*(1+exp(_b[1.presub2h]))-2))
					(postshift:	1/2*(exp(_b[1.presub2h])*exp(_b[1.presub1h])*exp(_b[1.sub1h])*exp(_b[1.sub2h])*exp(_b[1.sub3h])*exp(_b[1.sub4h])*exp(_b[1.postsub1h])*(1+exp(_b[1.postsub2h]))-2)), post;			
		#delimit	cr		
		
		***Net program effect 
		nlcom 		_b[program] + (2/4)*_b[preshift]+ (2/4)*_b[postshift]		
		
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++	
***UNIT SALES, SUBSIDIZED (response above and below price median)	

reghdfe dlogunits i.presub3h##ib1.treath##ib1.medprice i.presub2h##ib1.treath##ib1.medprice i.presub1h##ib1.treath##ib1.medprice i.sub1h##ib1.treath##ib1.medprice i.sub2h##ib1.treath##ib1.medprice i.sub3h##ib1.treath##ib1.medprice i.sub4h##ib1.treath##ib1.medprice i.postsub1h##ib1.treath##ib1.medprice i.postsub2h##ib1.treath##ib1.medprice i.postsub3h##ib1.treath##ib1.medprice mage mage2  if country!="Croatia", absorb(id2 cmt) cluster(id) 
est store subu_above		


reghdfe dlogunits i.presub3h##ib1.treath##ib0.medprice i.presub2h##ib1.treath##ib0.medprice i.presub1h##ib1.treath##ib0.medprice i.sub1h##ib1.treath##ib0.medprice i.sub2h##ib1.treath##ib0.medprice i.sub3h##ib1.treath##ib0.medprice i.sub4h##ib1.treath##ib0.medprice i.postsub1h##ib1.treath##ib0.medprice i.postsub2h##ib1.treath##ib0.medprice i.postsub3h##ib1.treath##ib0.medprice mage mage2  if country!="Croatia", absorb(id2 cmt) cluster(id) 
est store subu_below	

reghdfe dlogunits  i.presub3h##ib1.treath##ib4.label##ib1.medprice3 i.presub2h##ib1.treath##ib4.label##ib1.medprice3 i.presub1h##ib1.treath##ib4.label##ib1.medprice3 i.sub1h##ib1.treath##ib4.label##ib1.medprice3 i.sub2h##ib1.treath##ib4.label##ib1.medprice3 i.sub3h##ib1.treath##ib4.label##ib1.medprice3 i.sub4h##ib1.treath##ib4.label##ib1.medprice3 i.postsub1h##ib1.treath##ib4.label##ib1.medprice3 i.postsub2h##ib1.treath##ib4.label##ib1.medprice3 i.postsub3h##ib1.treath##ib4.label##ib1.medprice3  mage mage2  if country!="Croatia", absorb(id2 cmlt) cluster(id)
est store subu_above_a3

reghdfe dlogunits i.presub3h##ib1.treath##ib4.label##ib0.medprice3 i.presub2h##ib1.treath##ib4.label##ib0.medprice3 i.presub1h##ib1.treath##ib4.label##ib0.medprice3 i.sub1h##ib1.treath##ib4.label##ib0.medprice3 i.sub2h##ib1.treath##ib4.label##ib0.medprice3 i.sub3h##ib1.treath##ib4.label##ib0.medprice3 i.sub4h##ib1.treath##ib4.label##ib0.medprice3 i.postsub1h##ib1.treath##ib4.label##ib0.medprice3 i.postsub2h##ib1.treath##ib4.label##ib0.medprice3 i.postsub3h##ib1.treath##ib4.label##ib0.medprice3 mage mage2  if country!="Croatia", absorb(id2 cmlt) cluster(id)
est store subu_below_a3
		
esttab   subu subu_above subu_below subu_above_a3 subu_below_a3  , se star(* 0.10 ** 0.05 *** 0.01) mtitles nogaps b(%8.3f) t(%6.2f)  scalars(N ) order(1.presub3h 1.presub2h 1.presub1h 1.sub1h 1.sub2h 1.sub3h 1.sub4h 1.postsub1h 1.postsub2h 1.postsub3h) keep(1.presub3h 1.presub2h 1.presub1h 1.sub1h 1.sub2h 1.sub3h 1.sub4h 1.postsub1h 1.postsub2h 1.postsub3h ) 

esttab   subu subu_above subu_below subu_above_a3 subu_below_a3  using "HU_15_medianprice.tex" ,replace  se nostar mtitles nogaps b(%8.3f) t(%6.2f)  scalars(N ) order(1.presub3h 1.presub2h 1.presub1h 1.sub1h 1.sub2h 1.sub3h 1.sub4h 1.postsub1h 1.postsub2h 1.postsub3h) keep(1.presub3h 1.presub2h 1.presub1h 1.sub1h 1.sub2h 1.sub3h 1.sub4h 1.postsub1h 1.postsub2h 1.postsub3h) 		
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++				
**UNIT SALES, N0N-SUBSIDIZED

reghdfe dlogunits i.presub3h##i.treath i.presub2h##i.treath i.presub1h##i.treath i.sub1h##i.treath i.sub2h##i.treath i.sub3h##i.treath i.sub4h##i.treath i.postsub1h##i.treath i.postsub2h##i.treath i.postsub3h##i.treath mage mage2  if country!="Croatia", absorb(id2 cmt) cluster(id)
est store nonsubu
		
		
		***Program, preshift and postshift effects 
		#delimit;
		nlcom 		(program:  	1/4*(exp(_b[1.presub2h])*exp(_b[1.presub1h])*exp(_b[1.sub1h])*(1+exp(_b[1.sub2h])+exp(_b[1.sub2h])*exp(_b[1.sub3h])+exp(_b[1.sub2h])*exp(_b[1.sub3h])*exp(_b[1.sub4h]))-4)) 
					(preshift: 	1/2*(exp(_b[1.presub1h])*(1+exp(_b[1.presub2h]))-2))
					(postshift:	1/2*(exp(_b[1.presub2h])*exp(_b[1.presub1h])*exp(_b[1.sub1h])*exp(_b[1.sub2h])*exp(_b[1.sub3h])*exp(_b[1.sub4h])*exp(_b[1.postsub1h])*(1+exp(_b[1.postsub2h]))-2)), post;			
		#delimit	cr		
		
		***Net program effect 
		nlcom 		_b[program] + (2/4)*_b[preshift]+ (2/4)*_b[postshift]
		
	
	
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
*SUBSIDIZED PRICES

reghdfe dlogprice i.presub3h##ib1.treath i.presub2h##ib1.treath i.presub1h##ib1.treath i.sub1h##ib1.treath i.sub2h##ib1.treath i.sub3h##ib1.treath i.sub4h##ib1.treath i.postsub1h##ib1.treath i.postsub2h##ib1.treath i.postsub3h##ib1.treath mage mage2  if country!="Croatia" & samples, absorb(id2 cmt) cluster(id)
est store subp

		nlcom 1/4*(exp(_b[1.presub2h])*exp(_b[1.presub1h])*exp(_b[1.sub1h])*(1+exp(_b[1.sub2h])+exp(_b[1.sub2h])*exp(_b[1.sub3h])+exp(_b[1.sub2h])*exp(_b[1.sub3h])*exp(_b[1.sub4h]))-4)
		
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
*NON-SUBSIDIZED PRICES

reghdfe dlogprice i.presub3h##i.treath i.presub2h##i.treath i.presub1h##i.treath i.sub1h##i.treath i.sub2h##i.treath i.sub3h##i.treath i.sub4h##i.treath i.postsub1h##i.treath i.postsub2h##i.treath i.postsub3h##i.treath mage mage2  if country!="Croatia" & samples, absorb(id2 cmt) cluster(id)
		est store nonsubp
		nlcom 1/4*(exp(_b[1.presub2h])*exp(_b[1.presub1h])*exp(_b[1.sub1h])*(1+exp(_b[1.sub2h])+exp(_b[1.sub2h])*exp(_b[1.sub3h])+exp(_b[1.sub2h])*exp(_b[1.sub3h])*exp(_b[1.sub4h]))-4)

		
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

**RESULTS BY SUBSIDIZED LABEL



label list label

*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
***A+++

reghdfe dlogunits i.presub3h##ib1.treath##ib4.label i.presub2h##ib1.treath##ib4.label i.presub1h##ib1.treath##ib4.label i.sub1h##ib1.treath##ib4.label i.sub2h##ib1.treath##ib4.label i.sub3h##ib1.treath##ib4.label i.sub4h##ib1.treath##ib4.label i.postsub1h##ib1.treath##ib4.label i.postsub2h##ib1.treath##ib4.label i.postsub3h##ib1.treath##ib4.label mage mage2  if country!="Croatia", absorb(id2 cmlt) cluster(id)
est store label3 
generate samplel=e(sample)
codebook id if samplel
codebook id if samplel& treath==1
		
		***Program, preshift and postshift effects 
		#delimit;
		nlcom 		(program3:  	1/4*(exp(_b[1.presub2h])*exp(_b[1.presub1h])*exp(_b[1.sub1h])*(1+exp(_b[1.sub2h])+exp(_b[1.sub2h])*exp(_b[1.sub3h])+exp(_b[1.sub2h])*exp(_b[1.sub3h])*exp(_b[1.sub4h]))-4)) 
					(program2:  	1/4*(exp(_b[1.presub2h]+_b[1.presub2h#3.label])*exp(_b[1.presub1h]+_b[1.presub1h#3.label])*exp(_b[1.sub1h]+_b[1.sub1h#3.label])*(1+exp(_b[1.sub2h]+_b[1.sub2h#3.label])+exp(_b[1.sub2h]+_b[1.sub2h#3.label])*	                   exp(_b[1.sub3h]+_b[1.sub3h#3.label])+exp(_b[1.sub2h]+_b[1.sub2h#3.label])*exp(_b[1.sub3h]+_b[1.sub3h#3.label])*exp(_b[1.sub4h]+_b[1.sub4h#3.label]))-4)) 
					(program1:  	1/4*(exp(_b[1.presub2h]+_b[1.presub2h#2.label])*exp(_b[1.presub1h]+_b[1.presub1h#2.label])*exp(_b[1.sub1h]+_b[1.sub1h#2.label])*(1+exp(_b[1.sub2h]+_b[1.sub2h#2.label])+exp(_b[1.sub2h]+_b[1.sub2h#2.label])*                    exp(_b[1.sub3h]+_b[1.sub3h#2.label])+exp(_b[1.sub2h]+_b[1.sub2h#2.label])*exp(_b[1.sub3h]+_b[1.sub3h#2.label])*exp(_b[1.sub4h]+_b[1.sub4h#2.label]))-4)) 
					(program0:  	1/4*(exp(_b[1.presub2h]+_b[1.presub2h#0.treath])*exp(_b[1.presub1h]+_b[1.presub1h#0.treath])*exp(_b[1.sub1h]+_b[1.sub1h#0.treath])*(1+exp(_b[1.sub2h]+_b[1.sub2h#0.treath])+exp(_b[1.sub2h]+_b[1.sub2h#                   0.treath])*exp(_b[1.sub3h]+_b[1.sub3h#0.treath])+exp(_b[1.sub2h]+_b[1.sub2h#0.treath])*exp(_b[1.sub3h]+_b[1.sub3h#0.treath])*exp(_b[1.sub4h]+_b[1.sub4h#0.treath]))-4)) 
					(preshift3: 	1/2*(exp(_b[1.presub1h])*(1+exp(_b[1.presub2h]))-2))
					(preshift2: 	1/2*(exp(_b[1.presub1h]+_b[1.presub1h#3.label])*(1+exp(_b[1.presub2h]+_b[1.presub2h#3.label]))-2))
					(preshift1: 	1/2*(exp(_b[1.presub1h]+_b[1.presub1h#2.label])*(1+exp(_b[1.presub2h]+_b[1.presub2h#2.label]))-2))
					(preshift0: 	1/2*(exp(_b[1.presub1h]+_b[1.presub1h#0.treath])*(1+exp(_b[1.presub2h]+_b[1.presub2h#0.treath]))-2))
					(postshift3:	1/2*(exp(_b[1.presub2h])*exp(_b[1.presub1h])*exp(_b[1.sub1h])*exp(_b[1.sub2h])*exp(_b[1.sub3h])*exp(_b[1.sub4h])*exp(_b[1.postsub1h])*(1+exp(_b[1.postsub2h]))-2))
					(postshift2:	1/2*(exp(_b[1.presub2h]+_b[1.presub2h#3.label])*exp(_b[1.presub1h]+_b[1.presub1h#3.label])*exp(_b[1.sub1h]+_b[1.sub1h#3.label])*exp(_b[1.sub2h]+_b[1.sub2h#3.label])*exp(_b[1.sub3h]+_b[1.sub3h#3.label])*exp(                     _b[1.sub4h]+_b[1.sub4h#3.label])*exp(_b[1.postsub1h]+_b[1.postsub1h#3.label])*(1+exp(_b[1.postsub2h]+_b[1.postsub2h#3.label]))-2))
					(postshift1:	1/2*(exp(_b[1.presub2h]+_b[1.presub2h#2.label])*exp(_b[1.presub1h]+_b[1.presub1h#2.label])*exp(_b[1.sub1h]+_b[1.sub1h#2.label])*exp(_b[1.sub2h]+_b[1.sub2h#2.label])*exp(_b[1.sub3h]+_b[1.sub3h#2.label])*exp(                     _b[1.sub4h]+_b[1.sub4h#2.label])*exp(_b[1.postsub1h]+_b[1.postsub1h#2.label])*(1+exp(_b[1.postsub2h]+_b[1.postsub2h#2.label]))-2))
					(postshift0:    1/2*(exp(_b[1.presub2h]+_b[1.presub2h#0.treath])*exp(_b[1.presub1h]+_b[1.presub1h#0.treath])*exp(_b[1.sub1h]+_b[1.sub1h#0.treath])*exp(_b[1.sub2h]+_b[1.sub2h#0.treath])*exp(_b[1.sub3h]+_b[1.sub3h#0.treath])*exp(_b[1.sub4h]+_b[1.sub4h#0.treath])*exp(_b[1.postsub1h]+_b[1.postsub1h#0.treath])*(1+exp(_b[1.postsub2h]+_b[1.postsub2h#0.treath]))-2)), post;
		#delimit	cr		
		
		#delimit;
		nlcom 	(np3:  _b[program3] + (2/4)*_b[preshift3]+ (2/4)*_b[postshift3])
		 		(np2:  _b[program2] + (2/4)*_b[preshift2]+ (2/4)*_b[postshift2])
				(np1:  _b[program1] + (2/4)*_b[preshift1]+ (2/4)*_b[postshift1])
				(np0:  _b[program0] + (2/4)*_b[preshift0]+ (2/4)*_b[postshift0]), post;      
		#delimit	 cr
		***Program cost 
		nlcom  1000*5394000/(_b[np3]*20229.66*89.69*14+_b[np2]*16093.2*77.86*14+_b[np1]*24013.09*73.18*14+_b[np0]*944.27*86.71*14)
		
		***Program cost (25th percentile)
		nlcom  1000*5394000/(_b[np3]*20229.66*100.3*14+_b[np2]*16093.2*87.3*14+_b[np1]*24013.09*85*14+_b[np0]*944.27*86.71*14)
		
		***Program cost (10th percentile)
		nlcom  1000*5394000/(_b[np3]*20229.66*117.37*14+_b[np2]*16093.2*104.37*14+_b[np1]*24013.09*89.3*14+_b[np0]*944.27*86.71*14)
		
		***Energy savings
		nlcom  (_b[np3]*20229.66*89.69*14+_b[np2]*16093.2*77.86*14+_b[np1]*24013.09*73.18*14+_b[np0]*944.27*86.71*14)/1000

***A+++,SUBSIDIZED, 5-MONTHS
reghdfe dlogunits  i.presub5h##ib1.treath##ib4.label i.presub4h##ib1.treath##ib4.label i.presub3h##ib1.treath##ib4.label i.presub2h##ib1.treath##ib4.label i.presub1h##ib1.treath##ib4.label i.sub1h##ib1.treath##ib4.label i.sub2h##ib1.treath##ib4.label i.sub3h##ib1.treath##ib4.label i.sub4h##ib1.treath##ib4.label i.postsub1h##ib1.treath##ib4.label i.postsub2h##ib1.treath##ib4.label i.postsub3h##ib1.treath##ib4.label i.postsub4h##ib1.treath##ib4.label i.postsub5h##ib1.treath##ib4.label  mage mage2  if country!="Croatia", absorb(id2 cmlt) cluster(id)


		***Program, preshift and postshift effects 
		#delimit;
		nlcom 		(program:  	1/4*(exp(_b[1.presub5h])*exp(_b[1.presub4h])*exp(_b[1.presub3h])*exp(_b[1.presub2h])*exp(_b[1.presub1h])*exp(_b[1.sub1h])*(1+exp(_b[1.sub2h])+exp(_b[1.sub2h])*exp(_b[1.sub3h])+exp(_b[1.sub2h])*exp(_b[1.sub3h])*exp(_b[1.sub4h]))-4)) 
					(preshift: 	1/5*(exp(_b[1.presub1h])*(1+exp(_b[1.presub2h])+exp(_b[1.presub2h])*exp(_b[1.presub3h])+exp(_b[1.presub2h])*exp(_b[1.presub3h])*exp(_b[1.presub4h])+exp(_b[1.presub2h])*exp(_b[1.presub3h])*exp(_b[1.presub4h])*exp(_b[1.presub5h]))-5))
					(postshift:	1/5*(exp(_b[1.presub5h])*exp(_b[1.presub4h])*exp(_b[1.presub3h])*exp(_b[1.presub2h])*exp(_b[1.presub1h])*exp(_b[1.sub1h])*exp(_b[1.sub2h])*exp(_b[1.sub3h])*exp(_b[1.sub4h])*exp(_b[1.postsub1h])*(1+exp(_b[1.postsub2h])+exp(_b[1.postsub2h])*exp(_b[1.postsub3h])+exp(_b[1.postsub2h])*exp(_b[1.postsub3h])*exp(_b[1.postsub4h])+exp(_b[1.postsub2h])*exp(_b[1.postsub3h])*exp(_b[1.postsub4h])*exp(_b[1.postsub5h]))-5)), post;			
		#delimit	cr		
		
		***Net program effect 
		nlcom 		_b[program] + (5/4)*_b[preshift]+ (5/4)*_b[postshift]


***A+++, NON-SUBSIDIZED
reghdfe dlogunits  i.presub2h##i.treath##ib4.label i.presub1h##i.treath##ib4.label i.sub1h##i.treath##ib4.label i.sub2h##i.treath##ib4.label i.sub3h##i.treath##ib4.label i.sub4h##i.treath##ib4.label i.postsub1h##i.treath##ib4.label i.postsub2h##i.treath##ib4.label  mage mage2  if country!="Croatia", absorb(id2 cmlt) cluster(id)
		
		***Program, preshift and postshift effects 
		#delimit;
		nlcom 		(program:  	1/4*(exp(_b[1.presub2h])*exp(_b[1.presub1h])*exp(_b[1.sub1h])*(1+exp(_b[1.sub2h])+exp(_b[1.sub2h])*exp(_b[1.sub3h])+exp(_b[1.sub2h])*exp(_b[1.sub3h])*exp(_b[1.sub4h]))-4)) 
					(preshift: 	1/2*(exp(_b[1.presub1h])*(1+exp(_b[1.presub2h]))-2))
					(postshift:	1/2*(exp(_b[1.presub2h])*exp(_b[1.presub1h])*exp(_b[1.sub1h])*exp(_b[1.sub2h])*exp(_b[1.sub3h])*exp(_b[1.sub4h])*exp(_b[1.postsub1h])*(1+exp(_b[1.postsub2h]))-2)), post;			
		#delimit	cr		
		
		***Net program effect 
		nlcom 		_b[program] + (2/4)*_b[preshift]+ (2/4)*_b[postshift]
		

*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++		
***A++

reghdfe dlogunits i.presub3h##ib1.treath##ib3.label i.presub2h##ib1.treath##ib3.label i.presub1h##ib1.treath##ib3.label i.sub1h##ib1.treath##ib3.label i.sub2h##ib1.treath##ib3.label i.sub3h##ib1.treath##ib3.label i.sub4h##ib1.treath##ib3.label i.postsub1h##ib1.treath##ib3.label i.postsub2h##ib1.treath##ib3.label i.postsub3h##ib1.treath##ib3.label mage mage2  if country!="Croatia", absorb(id2 cmlt) cluster(id)
		est store label2
		
		***Program, preshift and postshift effects 
		#delimit;
		nlcom 		(program:  	1/4*(exp(_b[1.presub2h])*exp(_b[1.presub1h])*exp(_b[1.sub1h])*(1+exp(_b[1.sub2h])+exp(_b[1.sub2h])*exp(_b[1.sub3h])+exp(_b[1.sub2h])*exp(_b[1.sub3h])*exp(_b[1.sub4h]))-4)) 
					(preshift: 	1/2*(exp(_b[1.presub1h])*(1+exp(_b[1.presub2h]))-2))
					(postshift:	1/2*(exp(_b[1.presub2h])*exp(_b[1.presub1h])*exp(_b[1.sub1h])*exp(_b[1.sub2h])*exp(_b[1.sub3h])*exp(_b[1.sub4h])*exp(_b[1.postsub1h])*(1+exp(_b[1.postsub2h]))-2)), post;			
		#delimit	cr		
		
		***Net program effect 
		nlcom 		_b[program] + (2/4)*_b[preshift]+ (2/4)*_b[postshift]
		
***A++, NON-SUBSIDIZED

reghdfe dlogunits i.presub2h##i.treath##ib3.label i.presub1h##i.treath##ib3.label i.sub1h##i.treath##ib3.label i.sub2h##i.treath##ib3.label i.sub3h##i.treath##ib3.label i.sub4h##i.treath##ib3.label i.postsub1h##i.treath##ib3.label i.postsub2h##i.treath##ib3.label  mage mage2  if country!="Croatia", absorb(id2 cmlt) cluster(id)
		
		***Program, preshift and postshift effects 
		#delimit;
		nlcom 		(program:  	1/4*(exp(_b[1.presub2h])*exp(_b[1.presub1h])*exp(_b[1.sub1h])*(1+exp(_b[1.sub2h])+exp(_b[1.sub2h])*exp(_b[1.sub3h])+exp(_b[1.sub2h])*exp(_b[1.sub3h])*exp(_b[1.sub4h]))-4)) 
					(preshift: 	1/2*(exp(_b[1.presub1h])*(1+exp(_b[1.presub2h]))-2))
					(postshift:	1/2*(exp(_b[1.presub2h])*exp(_b[1.presub1h])*exp(_b[1.sub1h])*exp(_b[1.sub2h])*exp(_b[1.sub3h])*exp(_b[1.sub4h])*exp(_b[1.postsub1h])*(1+exp(_b[1.postsub2h]))-2)), post;			
		#delimit	cr		
		
		***Net program effect 
		nlcom 		_b[program] + (2/4)*_b[preshift]+ (2/4)*_b[postshift]		
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++		
**A+

reghdfe dlogunits  i.presub3h##ib1.treath##ib2.label i.presub2h##ib1.treath##ib2.label i.presub1h##ib1.treath##ib2.label i.sub1h##ib1.treath##ib2.label i.sub2h##ib1.treath##ib2.label i.sub3h##ib1.treath##ib2.label i.sub4h##ib1.treath##ib2.label i.postsub1h##ib1.treath##ib2.label i.postsub2h##ib1.treath##ib2.label i.postsub3h##ib1.treath##ib2.label mage mage2  if country!="Croatia", absorb(id2 cmlt) cluster(id)
		est store label1
		
		***Program, preshift and postshift effects 
		#delimit;
		nlcom 		(program:  	1/4*(exp(_b[1.presub2h])*exp(_b[1.presub1h])*exp(_b[1.sub1h])*(1+exp(_b[1.sub2h])+exp(_b[1.sub2h])*exp(_b[1.sub3h])+exp(_b[1.sub2h])*exp(_b[1.sub3h])*exp(_b[1.sub4h]))-4)) 
					(preshift: 	1/2*(exp(_b[1.presub1h])*(1+exp(_b[1.presub2h]))-2))
					(postshift:	1/2*(exp(_b[1.presub2h])*exp(_b[1.presub1h])*exp(_b[1.sub1h])*exp(_b[1.sub2h])*exp(_b[1.sub3h])*exp(_b[1.sub4h])*exp(_b[1.postsub1h])*(1+exp(_b[1.postsub2h]))-2)), post;			
		#delimit	cr		
		
		***Net program effect 
		nlcom 		_b[program] + (2/4)*_b[preshift]+ (2/4)*_b[postshift]
		
**A+, NON-SUBSIDIZED

reghdfe dlogunits  i.presub2h##i.treath##ib2.label i.presub1h##i.treath##ib2.label i.sub1h##i.treath##ib2.label i.sub2h##i.treath##ib2.label i.sub3h##i.treath##ib2.label i.sub4h##i.treath##ib2.label i.postsub1h##i.treath##ib2.label i.postsub2h##i.treath##ib2.label  mage mage2  if country!="Croatia", absorb(id2 cmlt) cluster(id)

		
		***Program, preshift and postshift effects 
		#delimit;
		nlcom 		(program:  	1/4*(exp(_b[1.presub2h])*exp(_b[1.presub1h])*exp(_b[1.sub1h])*(1+exp(_b[1.sub2h])+exp(_b[1.sub2h])*exp(_b[1.sub3h])+exp(_b[1.sub2h])*exp(_b[1.sub3h])*exp(_b[1.sub4h]))-4)) 
					(preshift: 	1/2*(exp(_b[1.presub1h])*(1+exp(_b[1.presub2h]))-2))
					(postshift:	1/2*(exp(_b[1.presub2h])*exp(_b[1.presub1h])*exp(_b[1.sub1h])*exp(_b[1.sub2h])*exp(_b[1.sub3h])*exp(_b[1.sub4h])*exp(_b[1.postsub1h])*(1+exp(_b[1.postsub2h]))-2)), post;			
		#delimit	cr		
		
		***Net program effect 
		nlcom 		_b[program] + (2/4)*_b[preshift]+ (2/4)*_b[postshift]
				
		
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++		
***PRICES BY LABEL

***A+++
reghdfe dlogprice i.presub3h##ib1.treath##ib4.label i.presub2h##ib1.treath##ib4.label i.presub1h##ib1.treath##ib4.label i.sub1h##ib1.treath##ib4.label i.sub2h##ib1.treath##ib4.label i.sub3h##ib1.treath##ib4.label i.sub4h##ib1.treath##ib4.label i.postsub1h##ib1.treath##ib4.label i.postsub2h##ib1.treath##ib4.label i.postsub3h##ib1.treath##ib4.label mage mage2  if country!="Croatia" & samplel, absorb(id2 cmlt) cluster(id)
		est store label3p
		nlcom 1/4*(exp(_b[1.presub2h])*exp(_b[1.presub1h])*exp(_b[1.sub1h])*(1+exp(_b[1.sub2h])+exp(_b[1.sub2h])*exp(_b[1.sub3h])+exp(_b[1.sub2h])*exp(_b[1.sub3h])*exp(_b[1.sub4h]))-4)
		
reghdfe dlogprice i.presub3h##i.treath##ib4.label  i.presub2h##i.treath##ib4.label i.presub1h##i.treath##ib4.label i.sub1h##i.treath##ib4.label i.sub2h##i.treath##ib4.label i.sub3h##i.treath##ib4.label i.sub4h##i.treath##ib4.label i.postsub1h##i.treath##ib4.label i.postsub2h##i.treath##ib4.label i.postsub3h##i.treath##ib4.label mage mage2  if country!="Croatia", absorb(id2 cmlt) cluster(id)		
		nlcom 1/4*(exp(_b[1.presub2h])*exp(_b[1.presub1h])*exp(_b[1.sub1h])*(1+exp(_b[1.sub2h])+exp(_b[1.sub2h])*exp(_b[1.sub3h])+exp(_b[1.sub2h])*exp(_b[1.sub3h])*exp(_b[1.sub4h]))-4)

		
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
***A++	

reghdfe dlogprice i.presub3h##ib1.treath##ib3.label i.presub2h##ib1.treath##ib3.label i.presub1h##ib1.treath##ib3.label i.sub1h##ib1.treath##ib3.label i.sub2h##ib1.treath##ib3.label i.sub3h##ib1.treath##ib3.label i.sub4h##ib1.treath##ib3.label i.postsub1h##ib1.treath##ib3.label i.postsub2h##ib1.treath##ib3.label i.postsub3h##ib1.treath##ib3.label  mage mage2  if country!="Croatia" & samplel, absorb(id2 cmlt) cluster(id)
est store label2p
		nlcom 1/4*(exp(_b[1.presub2h])*exp(_b[1.presub1h])*exp(_b[1.sub1h])*(1+exp(_b[1.sub2h])+exp(_b[1.sub2h])*exp(_b[1.sub3h])+exp(_b[1.sub2h])*exp(_b[1.sub3h])*exp(_b[1.sub4h]))-4)
		
reghdfe dlogprice i.presub3h##i.treath##ib3.label i.presub2h##i.treath##ib3.label i.presub1h##i.treath##ib3.label i.sub1h##i.treath##ib3.label i.sub2h##i.treath##ib3.label i.sub3h##i.treath##ib3.label i.sub4h##i.treath##ib3.label i.postsub1h##i.treath##ib3.label i.postsub2h##i.treath##ib3.label i.postsub3h##i.treath##ib3.label mage mage2  if country!="Croatia", absorb(id2 cmlt) cluster(id)		
		nlcom 1/4*(exp(_b[1.presub2h])*exp(_b[1.presub1h])*exp(_b[1.sub1h])*(1+exp(_b[1.sub2h])+exp(_b[1.sub2h])*exp(_b[1.sub3h])+exp(_b[1.sub2h])*exp(_b[1.sub3h])*exp(_b[1.sub4h]))-4)


*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
***A+

reghdfe dlogprice i.presub3h##ib1.treath##ib2.label  i.presub2h##ib1.treath##ib2.label i.presub1h##ib1.treath##ib2.label i.sub1h##ib1.treath##ib2.label i.sub2h##ib1.treath##ib2.label i.sub3h##ib1.treath##ib2.label i.sub4h##ib1.treath##ib2.label i.postsub1h##ib1.treath##ib2.label i.postsub2h##ib1.treath##ib2.label i.postsub3h##ib1.treath##ib2.label mage mage2  if country!="Croatia" & samplel , absorb(id2 cmlt) cluster(id)
est store label1p
		nlcom 1/4*(exp(_b[1.presub2h])*exp(_b[1.presub1h])*exp(_b[1.sub1h])*(1+exp(_b[1.sub2h])+exp(_b[1.sub2h])*exp(_b[1.sub3h])+exp(_b[1.sub2h])*exp(_b[1.sub3h])*exp(_b[1.sub4h]))-4)

reghdfe dlogprice i.presub3h##i.treath##ib2.label i.presub2h##i.treath##ib2.label i.presub1h##i.treath##ib2.label i.sub1h##i.treath##ib2.label i.sub2h##i.treath##ib2.label i.sub3h##i.treath##ib2.label i.sub4h##i.treath##ib2.label i.postsub1h##i.treath##ib2.label i.postsub2h##i.treath##ib2.label i.postsub3h##i.treath##ib2.label mage mage2  if country!="Croatia", absorb(id2 cmlt) cluster(id)

		nlcom 1/4*(exp(_b[1.presub2h])*exp(_b[1.presub1h])*exp(_b[1.sub1h])*(1+exp(_b[1.sub2h])+exp(_b[1.sub2h])*exp(_b[1.sub3h])+exp(_b[1.sub2h])*exp(_b[1.sub3h])*exp(_b[1.sub4h]))-4)

*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

***TABLES
**UNITS AND PRICES
esttab   subu nonsubu subp nonsubp , se star(* 0.10 ** 0.05 *** 0.01) mtitles nogaps b(%8.3f) t(%6.2f)  scalars(N ) order(1.presub3h 1.presub2h 1.presub1h 1.sub1h 1.sub2h 1.sub3h 1.sub4h 1.postsub1h 1.postsub2h 1.postsub3h) keep(1.presub3h 1.presub2h 1.presub1h 1.sub1h 1.sub2h 1.sub3h 1.sub4h 1.postsub1h 1.postsub2h 1.postsub3h) 

esttab   subu nonsubu subp nonsubp  using "HU_15.tex" ,replace  se nostar mtitles nogaps b(%8.3f) t(%6.2f)  scalars(N ) order(1.presub3h 1.presub2h 1.presub1h 1.sub1h 1.sub2h 1.sub3h 1.sub4h 1.postsub1h 1.postsub2h 1.postsub3h) keep(1.presub3h 1.presub2h 1.presub1h 1.sub1h 1.sub2h 1.sub3h 1.sub4h 1.postsub1h 1.postsub2h 1.postsub3h) 

esttab   subu_cy subu_trends, se star(* 0.10 ** 0.05 *** 0.01) mtitles nogaps b(%8.3f) t(%6.2f)  scalars(N ) order(1.presub3h 1.presub2h 1.presub1h 1.sub1h 1.sub2h 1.sub3h 1.sub4h 1.postsub1h 1.postsub2h 1.postsub3h) keep(1.presub3h 1.presub2h 1.presub1h 1.sub1h 1.sub2h 1.sub3h 1.sub4h 1.postsub1h 1.postsub2h 1.postsub3h) 

esttab   subu_cy subu_trends using "HU_15_cy.tex" ,replace  se nostar mtitles nogaps b(%8.3f) t(%6.2f)  scalars(N ) order(1.presub3h 1.presub2h 1.presub1h 1.sub1h 1.sub2h 1.sub3h 1.sub4h 1.postsub1h 1.postsub2h 1.postsub3h) keep(1.presub3h 1.presub2h 1.presub1h 1.sub1h 1.sub2h 1.sub3h 1.sub4h 1.postsub1h 1.postsub2h 1.postsub3h) 

**UNITS AND PRICES BY LABEL
esttab   label3 label2 label1  label3p label2p label1p, se star(* 0.10 ** 0.05 *** 0.01) mtitles nogaps b(%8.3f) t(%6.2f)  scalars(N ) order(1.presub3h 1.presub2h 1.presub1h 1.sub1h 1.sub2h 1.sub3h 1.sub4h 1.postsub1h 1.postsub2h 1.postsub3h) keep(1.presub3h 1.presub2h 1.presub1h 1.sub1h 1.sub2h 1.sub3h 1.sub4h 1.postsub1h 1.postsub2h 1.postsub3h) 

esttab   label3 label2 label1  label3p label2p label1p  using "HU_15_label.tex" ,replace  se nostar mtitles nogaps b(%8.3f) t(%6.2f)  scalars(N ) order(1.presub3h 1.presub2h 1.presub1h 1.sub1h 1.sub2h 1.sub3h 1.sub4h 1.postsub1h 1.postsub2h 1.postsub3h) keep(1.presub3h 1.presub2h 1.presub1h 1.sub1h 1.sub2h 1.sub3h 1.sub4h 1.postsub1h 1.postsub2h 1.postsub3h) 



restore


preserve

********************************************************************************************************************************************************************************************************************
*************************************************HUNGARY************************************************************************************************************************************************************
*************************************************Refrigerators and Freezers Program**2016***************************************************************************************************************************
*************************************************Effects on Unit Sales and Prices of Subsidized and Non-subsidized**************************************************************************************************
********************************************************************************************************************************************************************************************************************

egen cmt=group(country month treathf)
egen cmlt=group(country month energy_label_eu treathf)
egen cy	=group(country year)
encode country, gen(c)

tab energy_label_eu
encode energy_label_eu, gen(label)

xtset id2

drop if category=="washing machine"

egen median=median(price) if year==2016 & treathf==1 & month==7
gen mprice=1 if price>median & treathf==1 & year==2016 & month==7 & price!=.
replace mprice=0 if price<=median & treathf==1 & year==2016 & month==7 & price!=.
by id, sort: egen summp=sum(mprice)
by id, sort: gen medprice=1 if summp>0
replace medprice=0 if summp==0
drop median mprice summp 


egen median=median(price) if year==2016 & treathf==1 & month==7 & energy_label_eu=="A++"
gen mprice=1 if price>median & treathf==1 & year==2016 & month==7 & price!=. & energy_label_eu=="A++"
replace mprice=0 if price<=median & treathf==1 & year==2016 & month==7 & price!=. & energy_label_eu=="A++"
by id, sort: egen summp=sum(mprice)
by id, sort: gen medprice2=1 if summp>0
replace medprice2=0 if summp==0
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
***UNIT SALES, SUBSIDIZED

reghdfe dlogunits i.presub3hf##ib1.treathf i.presub2hf##ib1.treathf i.presub1hf##ib1.treathf i.sub1hf##ib1.treathf i.sub2hf##ib1.treathf i.sub3hf##ib1.treathf i.sub4hf##ib1.treathf i.postsub1hf##ib1.treathf  mage mage2 , absorb(id2 cmt) cluster(id)
est store subu
gen samples=e(sample)
codebook id if samples 
codebook id if samples & treathf==1

		***Program, preshift and postshift effects 
		#delimit;
		nlcom 		(program:  	1/4*(exp(_b[1.presub2hf])*exp(_b[1.presub1hf])*exp(_b[1.sub1hf])*(1+exp(_b[1.sub2hf])+exp(_b[1.sub2hf])*exp(_b[1.sub3hf])+exp(_b[1.sub2hf])*exp(_b[1.sub3hf])*exp(_b[1.sub4hf]))-4)) 
					(preshift: 	1/2*(exp(_b[1.presub1hf])*(1+exp(_b[1.presub2hf]))-2))
					(postshift:	1*(exp(_b[1.presub2hf])*exp(_b[1.presub1hf])*exp(_b[1.sub1hf])*exp(_b[1.sub2hf])*exp(_b[1.sub3hf])*exp(_b[1.sub4hf])*exp(_b[1.postsub1hf])-1)), post;			
		#delimit	cr		
		
		***Net program effect 
		nlcom 		_b[program] + (2/4)*_b[preshift]+ (1/4)*_b[postshift]
		
		
		
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
***UNIT SALES, SUBSIDIZED, CY-fe

reghdfe dlogunits i.presub3hf##ib1.treathf i.presub2hf##ib1.treathf i.presub1hf##ib1.treathf i.sub1hf##ib1.treathf i.sub2hf##ib1.treathf i.sub3hf##ib1.treathf i.sub4hf##ib1.treathf i.postsub1hf##ib1.treathf  mage mage2 , absorb(id2 cmt cy) cluster(id)
est store subu_cy

***Program, preshift and postshift effects 
		#delimit;
		nlcom 		(program:  	1/4*(exp(_b[1.presub2hf])*exp(_b[1.presub1hf])*exp(_b[1.sub1hf])*(1+exp(_b[1.sub2hf])+exp(_b[1.sub2hf])*exp(_b[1.sub3hf])+exp(_b[1.sub2hf])*exp(_b[1.sub3hf])*exp(_b[1.sub4hf]))-4)) 
					(preshift: 	1/2*(exp(_b[1.presub1hf])*(1+exp(_b[1.presub2hf]))-2))
					(postshift:	1*(exp(_b[1.presub2hf])*exp(_b[1.presub1hf])*exp(_b[1.sub1hf])*exp(_b[1.sub2hf])*exp(_b[1.sub3hf])*exp(_b[1.sub4hf])*exp(_b[1.postsub1hf])-1)), post;			
		#delimit	cr		
		
		***Net program effect 
		nlcom 		_b[program] + (2/4)*_b[preshift]+ (1/4)*_b[postshift]
		
				
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
***UNIT SALES, SUBSIDIZED, Country-specific linear time trends

reghdfe dlogunits i.presub3hf##ib1.treathf i.presub2hf##ib1.treathf i.presub1hf##ib1.treathf i.sub1hf##ib1.treathf i.sub2hf##ib1.treathf i.sub3hf##ib1.treathf i.sub4hf##ib1.treathf i.postsub1hf##ib1.treathf  mage mage2 , absorb(id2 cmt i.c#c.date) cluster(id)
est store subu_trends

***Program, preshift and postshift effects 
		#delimit;
		nlcom 		(program:  	1/4*(exp(_b[1.presub2hf])*exp(_b[1.presub1hf])*exp(_b[1.sub1hf])*(1+exp(_b[1.sub2hf])+exp(_b[1.sub2hf])*exp(_b[1.sub3hf])+exp(_b[1.sub2hf])*exp(_b[1.sub3hf])*exp(_b[1.sub4hf]))-4)) 
					(preshift: 	1/2*(exp(_b[1.presub1hf])*(1+exp(_b[1.presub2hf]))-2))
					(postshift:	1*(exp(_b[1.presub2hf])*exp(_b[1.presub1hf])*exp(_b[1.sub1hf])*exp(_b[1.sub2hf])*exp(_b[1.sub3hf])*exp(_b[1.sub4hf])*exp(_b[1.postsub1hf])-1)), post;			
		#delimit	cr		
		
		***Net program effect 
		nlcom 		_b[program] + (2/4)*_b[preshift]+ (1/4)*_b[postshift]
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++	
***UNIT SALES, SUBSIDIZED (response above and below price median)	

reghdfe dlogunits i.presub3hf##ib1.treathf##ib1.medprice i.presub2hf##ib1.treathf##ib1.medprice i.presub1hf##ib1.treathf##ib1.medprice i.sub1hf##ib1.treathf##ib1.medprice i.sub2hf##ib1.treathf##ib1.medprice i.sub3hf##ib1.treathf##ib1.medprice i.sub4hf##ib1.treathf##ib1.medprice i.postsub1hf##ib1.treathf##ib1.medprice  mage mage2 , absorb(id2 cmt) cluster(id)
est store subu_above		

reghdfe dlogunits i.presub3hf##ib1.treathf##ib0.medprice i.presub2hf##ib1.treathf##ib0.medprice i.presub1hf##ib1.treathf##ib0.medprice i.sub1hf##ib1.treathf##ib0.medprice i.sub2hf##ib1.treathf##ib0.medprice i.sub3hf##ib1.treathf##ib0.medprice i.sub4hf##ib1.treathf##ib0.medprice i.postsub1hf##ib1.treathf##ib0.medprice  mage mage2 , absorb(id2 cmt) cluster(id)
est store subu_below

reghdfe dlogunits i.presub3hf##ib1.treathf##ib3.label##ib1.medprice2 i.presub2hf##ib1.treathf##ib3.label##ib1.medprice2 i.presub1hf##ib1.treathf##ib3.label##ib1.medprice2 i.sub1hf##ib1.treathf##ib3.label##ib1.medprice2 i.sub2hf##ib1.treathf##ib3.label##ib1.medprice2 i.sub3hf##ib1.treathf##ib3.label##ib1.medprice2 i.sub4hf##ib1.treathf##ib3.label##ib1.medprice2 i.postsub1hf##ib1.treathf##ib3.label##ib1.medprice2  mage mage2  , absorb(id2 cmlt) cluster(id)
est store subu_above_a2

reghdfe dlogunits i.presub3hf##ib1.treathf##ib3.label##ib0.medprice2 i.presub2hf##ib1.treathf##ib3.label##ib0.medprice2 i.presub1hf##ib1.treathf##ib3.label##ib0.medprice2 i.sub1hf##ib1.treathf##ib3.label##ib0.medprice2 i.sub2hf##ib1.treathf##ib3.label##ib0.medprice2 i.sub3hf##ib1.treathf##ib3.label##ib0.medprice2 i.sub4hf##ib1.treathf##ib3.label##ib0.medprice2 i.postsub1hf##ib1.treathf##ib3.label##ib0.medprice2  mage mage2  , absorb(id2 cmlt) cluster(id)
est store subu_below_a2

esttab   subu subu_above subu_above_a2 subu_below subu_below_a2 , se star(* 0.10 ** 0.05 *** 0.01) mtitles nogaps b(%8.3f) t(%6.2f)  scalars(N ) order(1.presub3hf 1.presub2hf 1.presub1hf 1.sub1hf 1.sub2hf 1.sub3hf 1.sub4hf 1.postsub1hf) keep(1.presub3hf 1.presub2hf 1.presub1hf 1.sub1hf 1.sub2hf 1.sub3hf 1.sub4hf 1.postsub1hf) 

esttab   subu subu_above subu_below subu_above_a2 subu_below_a2  using "HU_16_medianprice.tex" ,replace  se nostar mtitles nogaps b(%8.3f) t(%6.2f)  scalars(N ) order(1.presub3hf 1.presub2hf 1.presub1hf 1.sub1hf 1.sub2hf 1.sub3hf 1.sub4hf 1.postsub1hf) keep(1.presub3hf 1.presub2hf 1.presub1hf 1.sub1hf 1.sub2hf 1.sub3hf 1.sub4hf 1.postsub1hf) 
		
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++	
**UNIT SALES, N0N-SUBSIDIZED

reghdfe dlogunits i.presub3hf##i.treathf i.presub2hf##i.treathf i.presub1hf##i.treathf i.sub1hf##i.treathf i.sub2hf##i.treathf i.sub3hf##i.treathf i.sub4hf##i.treathf i.postsub1hf##i.treathf  mage mage2 , absorb(id2 cmt) cluster(id)
est store nonsubu
    			
		***Program, preshift and postshift effects 
		#delimit;
		nlcom 		(program:  	1/4*(exp(_b[1.presub2hf])*exp(_b[1.presub1hf])*exp(_b[1.sub1hf])*(1+exp(_b[1.sub2hf])+exp(_b[1.sub2hf])*exp(_b[1.sub3hf])+exp(_b[1.sub2hf])*exp(_b[1.sub3hf])*exp(_b[1.sub4hf]))-4)) 
					(preshift: 	1/2*(exp(_b[1.presub1hf])*(1+exp(_b[1.presub2hf]))-2))
					(postshift:	1*(exp(_b[1.presub2hf])*exp(_b[1.presub1hf])*exp(_b[1.sub1hf])*exp(_b[1.sub2hf])*exp(_b[1.sub3hf])*exp(_b[1.sub4hf])*exp(_b[1.postsub1hf])-1)), post;			
		#delimit	cr			
		***Net program effect 
		nlcom 		_b[program] + (2/4)*_b[preshift]+ (1/4)*_b[postshift]
	
	
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
*SUBSIDIZED PRICES

reghdfe dlogprice i.presub3hf##ib1.treathf i.presub2hf##ib1.treathf i.presub1hf##ib1.treathf i.sub1hf##ib1.treathf i.sub2hf##ib1.treathf i.sub3hf##ib1.treathf i.sub4hf##ib1.treathf i.postsub1hf##ib1.treathf  mage mage2  if  samples, absorb(id2 cmt) cluster(id)
		est store subp
		nlcom 1/4*(exp(_b[1.presub2hf])*exp(_b[1.presub1hf])*exp(_b[1.sub1hf])*(1+exp(_b[1.sub2hf])+exp(_b[1.sub2hf])*exp(_b[1.sub3hf])+exp(_b[1.sub2hf])*exp(_b[1.sub3hf])*exp(_b[1.sub4hf]))-4)
	
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
*NON-SUBSIDIZED PRICES

reghdfe dlogprice i.presub3hf##i.treathf i.presub2hf##i.treathf i.presub1hf##i.treathf i.sub1hf##i.treathf i.sub2hf##i.treathf i.sub3hf##i.treathf i.sub4hf##i.treathf i.postsub1hf##i.treathf  mage mage2  if  samples, absorb(id2 cmt) cluster(id)
		est store nonsubp
		nlcom 1/4*(exp(_b[1.presub2hf])*exp(_b[1.presub1hf])*exp(_b[1.sub1hf])*(1+exp(_b[1.sub2hf])+exp(_b[1.sub2hf])*exp(_b[1.sub3hf])+exp(_b[1.sub2hf])*exp(_b[1.sub3hf])*exp(_b[1.sub4hf]))-4)

*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
**RESULTS BY SUBSIDIZED LABEL

label list label

***A+++
reghdfe dlogunits i.presub3hf##ib1.treathf##ib4.label i.presub2hf##ib1.treathf##ib4.label i.presub1hf##ib1.treathf##ib4.label i.sub1hf##ib1.treathf##ib4.label i.sub2hf##ib1.treathf##ib4.label i.sub3hf##ib1.treathf##ib4.label i.sub4hf##ib1.treathf##ib4.label i.postsub1hf##ib1.treathf##ib4.label  mage mage2 , absorb(id2 cmlt) cluster(id)
est store label3
generate samplel=e(sample)
codebook id if samplel
codebook id if samplel& treathf==1
		
		***Program, preshift and postshift effects (3: A+++; 2: A++; 1: A+.)
		#delimit;
		nlcom 		(program3:  	1/4*(exp(_b[1.presub2hf])*exp(_b[1.presub1hf])*exp(_b[1.sub1hf])*(1+exp(_b[1.sub2hf])+exp(_b[1.sub2hf])*exp(_b[1.sub3hf])+exp(_b[1.sub2hf])*exp(_b[1.sub3hf])*exp(_b[1.sub4hf]))-4)) 
					(program2:  	1/4*(exp((_b[1.presub2hf]+_b[1.presub2hf#3.label]))*exp((_b[1.presub1hf]+_b[1.presub1hf#3.label]))*exp((_b[1.sub1hf]+_b[1.sub1hf#3.label]))*(1+exp(_b[1.sub2hf]+_b[1.sub2hf#3.label])+exp(_b[1.sub2hf]+_b[1.sub2hf#3.label])*                     exp(_b[1.sub3hf]+_b[1.sub3hf#3.label])+exp(_b[1.sub2hf]+_b[1.sub2hf#3.label])*exp(_b[1.sub3hf]+_b[1.sub3hf#3.label])*exp(_b[1.sub4hf]+_b[1.sub4hf#3.label]))-4)) 
					(program1:  	1/4*(exp((_b[1.presub2hf]+_b[1.presub2hf#2.label]))*exp((_b[1.presub1hf]+_b[1.presub1hf#2.label]))*exp((_b[1.sub1hf]+_b[1.sub1hf#2.label]))*(1+exp(_b[1.sub2hf]+_b[1.sub2hf#2.label])+exp(_b[1.sub2hf]+_b[1.sub2hf#2.label])*                     exp(_b[1.sub3hf]+_b[1.sub3hf#2.label])+exp(_b[1.sub2hf]+_b[1.sub2hf#2.label])*exp(_b[1.sub3hf]+_b[1.sub3hf#2.label])*exp(_b[1.sub4hf]+_b[1.sub4hf#2.label]))-4)) 
					(preshift3: 	1/2*(exp(_b[1.presub1hf])*(1+exp(_b[1.presub2hf]))-2))
					(preshift2: 	1/2*(exp(_b[1.presub1hf]+_b[1.presub1hf#3.label])*(1+exp(_b[1.presub2hf]+_b[1.presub2hf#3.label]))-2))
					(preshift1: 	1/2*(exp(_b[1.presub1hf]+_b[1.presub1hf#2.label])*(1+exp(_b[1.presub2hf]+_b[1.presub2hf#2.label]))-2))
					(postshift3:	1*(exp(_b[1.presub2hf])*exp(_b[1.presub1hf])*exp(_b[1.sub1hf])*exp(_b[1.sub2hf])*exp(_b[1.sub3hf])*exp(_b[1.sub4hf])*exp(_b[1.postsub1hf])-1))
					(postshift2:	1*(exp(_b[1.presub2hf]+_b[1.presub2hf#3.label])*exp(_b[1.presub1hf]+_b[1.presub1hf#3.label])*exp(_b[1.sub1hf]+_b[1.sub1hf#3.label])*exp(_b[1.sub2hf]+_b[1.sub2hf#3.label])*exp(_b[1.sub3hf]+_b[1.sub3hf#3.label])*exp(_b[1.sub4hf]+                     _b[1.sub4hf#3.label])*exp(_b[1.postsub1hf]+_b[1.postsub1hf#3.label])-1))	
					(postshift1:	1*(exp(_b[1.presub2hf]+_b[1.presub2hf#2.label])*exp(_b[1.presub1hf]+_b[1.presub1hf#2.label])*exp(_b[1.sub1hf]+_b[1.sub1hf#2.label])*exp(_b[1.sub2hf]+_b[1.sub2hf#2.label])*exp(_b[1.sub3hf]+_b[1.sub3hf#2.label])*exp(_b[1.sub4hf]+                     _b[1.sub4hf#2.label])*exp(_b[1.postsub1hf]+_b[1.postsub1hf#2.label])-1)), post;	
		#delimit	cr			
		***Net program effects 
		#delimit;
		nlcom 	(np3:  _b[program3] + (2/4)*_b[preshift3]+ (1/4)*_b[postshift3])
		 		(np2:  _b[program2] + (2/4)*_b[preshift2]+ (1/4)*_b[postshift2])
				(np1:  _b[program1] + (2/4)*_b[preshift1]+ (1/4)*_b[postshift1]), post;      
		#delimit	 cr
		***Program cost 
		nlcom  1000*4259000/(_b[np3]*941.35*77.75*23+_b[np2]*13037.29*11.42*23-_b[np1]*66285.86*28.29*23), level (90)
		
			***Program cost (25th percentile)
		nlcom  1000*4259000/(_b[np3]*941.35*84.06*23+_b[np2]*13037.29*47.06*23-_b[np1]*66285.86*43.06*23), level (90)
		
		***Program cost (10th percentile)
		nlcom  1000*4259000/(_b[np3]*941.35*116.06*23+_b[np2]*13037.29*104.06*23-_b[np1]*66285.86*102.06*23), level (90)
		
		
		***Energy savings
		nlcom  (_b[np3]*941.35*77.75*23+_b[np2]*13037.29*11.42*23-_b[np1]*66285.86*28.29*23)/1000, level (90)
		
		
		
***A+++, SUBSIDIZED, 5-MONTHS BEFORE
reghdfe dlogunits i.presub5hf##ib1.treathf##ib4.label i.presub4hf##ib1.treathf##ib4.label i.presub3hf##ib1.treathf##ib4.label i.presub2hf##ib1.treathf##ib4.label i.presub1hf##ib1.treathf##ib4.label i.sub1hf##ib1.treathf##ib4.label i.sub2hf##ib1.treathf##ib4.label i.sub3hf##ib1.treathf##ib4.label i.sub4hf##ib1.treathf##ib4.label i.postsub1hf##ib1.treathf##ib4.label  mage mage2  , absorb(id2 cmlt) cluster(id)


		***Program, preshift and postshift effects 
		#delimit;
		nlcom 		(program:  	1/4*(exp(_b[1.presub5hf])*exp(_b[1.presub4hf])*exp(_b[1.presub3hf])*exp(_b[1.presub2hf])*exp(_b[1.presub1hf])*exp(_b[1.sub1hf])*(1+exp(_b[1.sub2hf])+exp(_b[1.sub2hf])*exp(_b[1.sub3hf])+exp(_b[1.sub2hf])*exp(_b[1.sub3hf])*exp(_b[1.sub4hf]))-4)) 
					(preshift: 	1/5*(exp(_b[1.presub1hf])*(1+exp(_b[1.presub2hf])+exp(_b[1.presub2hf])*exp(_b[1.presub3hf])+exp(_b[1.presub2hf])*exp(_b[1.presub3hf])*exp(_b[1.presub4hf])+exp(_b[1.presub2hf])*exp(_b[1.presub3hf])*exp(_b[1.presub4hf])*exp(_b[1.presub5hf]))-5))
					(postshift:	1*(exp(_b[1.presub5hf])*exp(_b[1.presub4hf])*exp(_b[1.presub3hf])*exp(_b[1.presub2hf])*exp(_b[1.presub1hf])*exp(_b[1.sub1hf])*exp(_b[1.sub2hf])*exp(_b[1.sub3hf])*exp(_b[1.sub4hf])*exp(_b[1.postsub1hf])-1)), post;			
		#delimit	cr		
		
		***Net program effect 
		nlcom 		_b[program] + (5/4)*_b[preshift]+ (1/4)*_b[postshift]


		
***A+++, NON-SUBSIDIZED
reghdfe dlogunits i.presub3hf##i.treathf##ib4.label i.presub2hf##i.treathf##ib4.label i.presub1hf##i.treathf##ib4.label i.sub1hf##i.treathf##ib4.label i.sub2hf##i.treathf##ib4.label i.sub3hf##i.treathf##ib4.label i.sub4hf##i.treathf##ib4.label i.postsub1hf##i.treathf##ib4.label  mage mage2  , absorb(id2 cmlt) cluster(id)

		
		***Program, preshift and postshift effects 
		#delimit;
		nlcom 		(program:  	1/4*(exp(_b[1.presub2hf])*exp(_b[1.presub1hf])*exp(_b[1.sub1hf])*(1+exp(_b[1.sub2hf])+exp(_b[1.sub2hf])*exp(_b[1.sub3hf])+exp(_b[1.sub2hf])*exp(_b[1.sub3hf])*exp(_b[1.sub4hf]))-4)) 
					(preshift: 	1/2*(exp(_b[1.presub1hf])*(1+exp(_b[1.presub2hf]))-2))
					(postshift:	1*(exp(_b[1.presub2hf])*exp(_b[1.presub1hf])*exp(_b[1.sub1hf])*exp(_b[1.sub2hf])*exp(_b[1.sub3hf])*exp(_b[1.sub4hf])*exp(_b[1.postsub1hf])-1)), post;			
		#delimit	cr			
		***Net program effect 
		nlcom 		_b[program] + (2/4)*_b[preshift]+ (1/4)*_b[postshift]
		
		
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
***A++

reghdfe dlogunits i.presub3hf##ib1.treathf##ib3.label i.presub2hf##ib1.treathf##ib3.label i.presub1hf##ib1.treathf##ib3.label i.sub1hf##ib1.treathf##ib3.label i.sub2hf##ib1.treathf##ib3.label i.sub3hf##ib1.treathf##ib3.label i.sub4hf##ib1.treathf##ib3.label i.postsub1hf##ib1.treathf##ib3.label  mage mage2  , absorb(id2 cmlt) cluster(id)
		est store label2
		***Program, preshift and postshift effects 
		#delimit;
		nlcom 		(program:  	1/4*(exp(_b[1.presub2hf])*exp(_b[1.presub1hf])*exp(_b[1.sub1hf])*(1+exp(_b[1.sub2hf])+exp(_b[1.sub2hf])*exp(_b[1.sub3hf])+exp(_b[1.sub2hf])*exp(_b[1.sub3hf])*exp(_b[1.sub4hf]))-4)) 
					(preshift: 	1/2*(exp(_b[1.presub1hf])*(1+exp(_b[1.presub2hf]))-2))
					(postshift:	1*(exp(_b[1.presub2hf])*exp(_b[1.presub1hf])*exp(_b[1.sub1hf])*exp(_b[1.sub2hf])*exp(_b[1.sub3hf])*exp(_b[1.sub4hf])*exp(_b[1.postsub1hf])-1)), post;			
		#delimit	cr			
		***Net program effect 
		nlcom 		_b[program] + (2/4)*_b[preshift]+ (1/4)*_b[postshift]
		
***A++, 5-MONTHS BEFORE

reghdfe dlogunits i.presub5hf##ib1.treathf##ib3.label i.presub4hf##ib1.treathf##ib3.label i.presub3hf##ib1.treathf##ib3.label i.presub2hf##ib1.treathf##ib3.label i.presub1hf##ib1.treathf##ib3.label i.sub1hf##ib1.treathf##ib3.label i.sub2hf##ib1.treathf##ib3.label i.sub3hf##ib1.treathf##ib3.label i.sub4hf##ib1.treathf##ib3.label i.postsub1hf##ib1.treathf##ib3.label  mage mage2  , absorb(id2 cmlt) cluster(id)


		***Program, preshift and postshift effects 
		#delimit;
		nlcom 		(program:  	1/4*(exp(_b[1.presub5hf])*exp(_b[1.presub4hf])*exp(_b[1.presub3hf])*exp(_b[1.presub2hf])*exp(_b[1.presub1hf])*exp(_b[1.sub1hf])*(1+exp(_b[1.sub2hf])+exp(_b[1.sub2hf])*exp(_b[1.sub3hf])+exp(_b[1.sub2hf])*exp(_b[1.sub3hf])*exp(_b[1.sub4hf]))-4)) 
					(preshift: 	1/5*(exp(_b[1.presub1hf])*(1+exp(_b[1.presub2hf])+exp(_b[1.presub2hf])*exp(_b[1.presub3hf])+exp(_b[1.presub2hf])*exp(_b[1.presub3hf])*exp(_b[1.presub4hf])+exp(_b[1.presub2hf])*exp(_b[1.presub3hf])*exp(_b[1.presub4hf])*exp(_b[1.presub5hf]))-5))
					(postshift:	1*(exp(_b[1.presub5hf])*exp(_b[1.presub4hf])*exp(_b[1.presub3hf])*exp(_b[1.presub2hf])*exp(_b[1.presub1hf])*exp(_b[1.sub1hf])*exp(_b[1.sub2hf])*exp(_b[1.sub3hf])*exp(_b[1.sub4hf])*exp(_b[1.postsub1hf])-1)), post;			
		#delimit	cr		
		
		***Net program effect 
		nlcom 		_b[program] + (5/4)*_b[preshift]+ (1/4)*_b[postshift]
		
		
***A++, NON-SUBSIDIZED
reghdfe dlogunits i.presub3hf##i.treathf##ib3.label i.presub2hf##i.treathf##ib3.label i.presub1hf##i.treathf##ib3.label i.sub1hf##i.treathf##ib3.label i.sub2hf##i.treathf##ib3.label i.sub3hf##i.treathf##ib3.label i.sub4hf##i.treathf##ib3.label i.postsub1hf##i.treathf##ib3.label  mage mage2  , absorb(id2 cmlt) cluster(id)
	
		***Program, preshift and postshift effects 
		#delimit;
		nlcom 		(program:  	1/4*(exp(_b[1.presub2hf])*exp(_b[1.presub1hf])*exp(_b[1.sub1hf])*(1+exp(_b[1.sub2hf])+exp(_b[1.sub2hf])*exp(_b[1.sub3hf])+exp(_b[1.sub2hf])*exp(_b[1.sub3hf])*exp(_b[1.sub4hf]))-4)) 
					(preshift: 	1/2*(exp(_b[1.presub1hf])*(1+exp(_b[1.presub2hf]))-2))
					(postshift:	1*(exp(_b[1.presub2hf])*exp(_b[1.presub1hf])*exp(_b[1.sub1hf])*exp(_b[1.sub2hf])*exp(_b[1.sub3hf])*exp(_b[1.sub4hf])*exp(_b[1.postsub1hf])-1)), post;			
		#delimit	cr			
		***Net program effect 
		nlcom 		_b[program] + (2/4)*_b[preshift]+ (1/4)*_b[postshift]
		
		
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
**A+

reghdfe dlogunits i.presub3hf##ib1.treathf##ib2.label i.presub2hf##ib1.treathf##ib2.label i.presub1hf##ib1.treathf##ib2.label i.sub1hf##ib1.treathf##ib2.label i.sub2hf##ib1.treathf##ib2.label i.sub3hf##ib1.treathf##ib2.label i.sub4hf##ib1.treathf##ib2.label i.postsub1hf##ib1.treathf##ib2.label  mage mage2  , absorb(id2 cmlt) cluster(id)
		est store label1
		***Program, preshift and postshift effects 
		#delimit;
		nlcom 		(program:  	1/4*(exp(_b[1.presub2hf])*exp(_b[1.presub1hf])*exp(_b[1.sub1hf])*(1+exp(_b[1.sub2hf])+exp(_b[1.sub2hf])*exp(_b[1.sub3hf])+exp(_b[1.sub2hf])*exp(_b[1.sub3hf])*exp(_b[1.sub4hf]))-4)) 
					(preshift: 	1/2*(exp(_b[1.presub1hf])*(1+exp(_b[1.presub2hf]))-2))
					(postshift:	1*(exp(_b[1.presub2hf])*exp(_b[1.presub1hf])*exp(_b[1.sub1hf])*exp(_b[1.sub2hf])*exp(_b[1.sub3hf])*exp(_b[1.sub4hf])*exp(_b[1.postsub1hf])-1)), post;			
		#delimit	cr			
		***Net program effect 
		nlcom 		_b[program] + (2/4)*_b[preshift]+ (1/4)*_b[postshift]
	
**A+, NON-SUBSIDIZED
reghdfe dlogunits i.presub3hf##i.treathf##ib2.label i.presub2hf##i.treathf##ib2.label i.presub1hf##i.treathf##ib2.label i.sub1hf##i.treathf##ib2.label i.sub2hf##i.treathf##ib2.label i.sub3hf##i.treathf##ib2.label i.sub4hf##i.treathf##ib2.label i.postsub1hf##i.treathf##ib2.label  mage mage2  , absorb(id2 cmlt) cluster(id)
		
		***Program, preshift and postshift effects 
		#delimit;
		nlcom 		(program:  	1/4*(exp(_b[1.presub2hf])*exp(_b[1.presub1hf])*exp(_b[1.sub1hf])*(1+exp(_b[1.sub2hf])+exp(_b[1.sub2hf])*exp(_b[1.sub3hf])+exp(_b[1.sub2hf])*exp(_b[1.sub3hf])*exp(_b[1.sub4hf]))-4)) 
					(preshift: 	1/2*(exp(_b[1.presub1hf])*(1+exp(_b[1.presub2hf]))-2))
					(postshift:	1*(exp(_b[1.presub2hf])*exp(_b[1.presub1hf])*exp(_b[1.sub1hf])*exp(_b[1.sub2hf])*exp(_b[1.sub3hf])*exp(_b[1.sub4hf])*exp(_b[1.postsub1hf])-1)), post;			
		#delimit	cr			
		***Net program effect 
		nlcom 		_b[program] + (2/4)*_b[preshift]+ (1/4)*_b[postshift]
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++	
***PRICES

**A+++
reghdfe dlogprice i.presub3hf##ib1.treathf##ib4.label i.presub2hf##ib1.treathf##ib4.label i.presub1hf##ib1.treathf##ib4.label i.sub1hf##ib1.treathf##ib4.label i.sub2hf##ib1.treathf##ib4.label i.sub3hf##ib1.treathf##ib4.label i.sub4hf##ib1.treathf##ib4.label i.postsub1hf##ib1.treathf##ib4.label  mage mage2  if  samplel, absorb(id2 cmlt) cluster(id)
		est store label3p
		
		nlcom 1/4*(exp(_b[1.presub2hf])*exp(_b[1.presub1hf])*exp(_b[1.sub1hf])*(1+exp(_b[1.sub2hf])+exp(_b[1.sub2hf])*exp(_b[1.sub3hf])+exp(_b[1.sub2hf])*exp(_b[1.sub3hf])*exp(_b[1.sub4hf]))-4)
		
reghdfe dlogprice i.presub3hf##i.treathf##ib4.label i.presub2hf##i.treathf##ib4.label i.presub1hf##i.treathf##ib4.label i.sub1hf##i.treathf##ib4.label i.sub2hf##i.treathf##ib4.label i.sub3hf##i.treathf##ib4.label i.sub4hf##i.treathf##ib4.label i.postsub1hf##i.treathf##ib4.label  mage mage2  , absorb(id2 cmlt) cluster(id)	
	
		nlcom 1/4*(exp(_b[1.presub2hf])*exp(_b[1.presub1hf])*exp(_b[1.sub1hf])*(1+exp(_b[1.sub2hf])+exp(_b[1.sub2hf])*exp(_b[1.sub3hf])+exp(_b[1.sub2hf])*exp(_b[1.sub3hf])*exp(_b[1.sub4hf]))-4)

*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++	
**A++

reghdfe dlogprice i.presub3hf##ib1.treathf##ib3.label i.presub2hf##ib1.treathf##ib3.label i.presub1hf##ib1.treathf##ib3.label i.sub1hf##ib1.treathf##ib3.label i.sub2hf##ib1.treathf##ib3.label i.sub3hf##ib1.treathf##ib3.label i.sub4hf##ib1.treathf##ib3.label i.postsub1hf##ib1.treathf##ib3.label  mage mage2  if  samplel, absorb(id2 cmlt) cluster(id)
		est store label2p
		
		nlcom 1/4*(exp(_b[1.presub2hf])*exp(_b[1.presub1hf])*exp(_b[1.sub1hf])*(1+exp(_b[1.sub2hf])+exp(_b[1.sub2hf])*exp(_b[1.sub3hf])+exp(_b[1.sub2hf])*exp(_b[1.sub3hf])*exp(_b[1.sub4hf]))-4)

reghdfe dlogprice i.presub3hf##i.treathf##ib3.label i.presub2hf##i.treathf##ib3.label i.presub1hf##i.treathf##ib3.label i.sub1hf##i.treathf##ib3.label i.sub2hf##i.treathf##ib3.label i.sub3hf##i.treathf##ib3.label i.sub4hf##i.treathf##ib3.label i.postsub1hf##i.treathf##ib3.label  mage mage2  , absorb(id2 cmlt) cluster(id)		

		nlcom 1/4*(exp(_b[1.presub2hf])*exp(_b[1.presub1hf])*exp(_b[1.sub1hf])*(1+exp(_b[1.sub2hf])+exp(_b[1.sub2hf])*exp(_b[1.sub3hf])+exp(_b[1.sub2hf])*exp(_b[1.sub3hf])*exp(_b[1.sub4hf]))-4)
		
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++		
**A+

reghdfe dlogprice i.presub3hf##ib1.treathf##ib2.label i.presub2hf##ib1.treathf##ib2.label i.presub1hf##ib1.treathf##ib2.label i.sub1hf##ib1.treathf##ib2.label i.sub2hf##ib1.treathf##ib2.label i.sub3hf##ib1.treathf##ib2.label i.sub4hf##ib1.treathf##ib2.label i.postsub1hf##ib1.treathf##ib2.label  mage mage2  if  samplel, absorb(id2 cmlt) cluster(id)
		est store label1p
		
		nlcom 1/4*(exp(_b[1.presub2hf])*exp(_b[1.presub1hf])*exp(_b[1.sub1hf])*(1+exp(_b[1.sub2hf])+exp(_b[1.sub2hf])*exp(_b[1.sub3hf])+exp(_b[1.sub2hf])*exp(_b[1.sub3hf])*exp(_b[1.sub4hf]))-4)

		
reghdfe dlogprice i.presub3hf##i.treathf##ib2.label i.presub2hf##i.treathf##ib2.label i.presub1hf##i.treathf##ib2.label i.sub1hf##i.treathf##ib2.label i.sub2hf##i.treathf##ib2.label i.sub3hf##i.treathf##ib2.label i.sub4hf##i.treathf##ib2.label i.postsub1hf##i.treathf##ib2.label  mage mage2  , absorb(id2 cmlt) cluster(id)		

		nlcom 1/4*(exp(_b[1.presub2hf])*exp(_b[1.presub1hf])*exp(_b[1.sub1hf])*(1+exp(_b[1.sub2hf])+exp(_b[1.sub2hf])*exp(_b[1.sub3hf])+exp(_b[1.sub2hf])*exp(_b[1.sub3hf])*exp(_b[1.sub4hf]))-4)

		
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
***TABLES

**UNITS AND PRICES
esttab   subu nonsubu subp nonsubp , se star(* 0.10 ** 0.05 *** 0.01) mtitles nogaps b(%8.3f) t(%6.2f)  scalars(N ) order(1.presub3hf 1.presub2hf 1.presub1hf 1.sub1hf 1.sub2hf 1.sub3hf 1.sub4hf 1.postsub1hf) keep(1.presub3hf 1.presub2hf 1.presub1hf 1.sub1hf 1.sub2hf 1.sub3hf 1.sub4hf 1.postsub1hf) 

esttab   subu nonsubu subp nonsubp  using "HU_16.tex" ,replace  se nostar mtitles nogaps b(%8.3f) t(%6.2f)  scalars(N ) order(1.presub3hf 1.presub2hf 1.presub1hf 1.sub1hf 1.sub2hf 1.sub3hf 1.sub4hf 1.postsub1hf) keep(1.presub3hf 1.presub2hf 1.presub1hf 1.sub1hf 1.sub2hf 1.sub3hf 1.sub4hf 1.postsub1hf) 

esttab   subu_cy subu_trends,se star(* 0.10 ** 0.05 *** 0.01) mtitles nogaps b(%8.3f) t(%6.2f)  scalars(N ) order(1.presub3hf 1.presub2hf 1.presub1hf 1.sub1hf 1.sub2hf 1.sub3hf 1.sub4hf 1.postsub1hf) keep(1.presub3hf 1.presub2hf 1.presub1hf 1.sub1hf 1.sub2hf 1.sub3hf 1.sub4hf 1.postsub1hf)

esttab   subu_cy subu_trends  using "HU_16_cy.tex" ,replace  se nostar mtitles nogaps b(%8.3f) t(%6.2f)  scalars(N ) order(1.presub3hf 1.presub2hf 1.presub1hf 1.sub1hf 1.sub2hf 1.sub3hf 1.sub4hf 1.postsub1hf) keep(1.presub3hf 1.presub2hf 1.presub1hf 1.sub1hf 1.sub2hf 1.sub3hf 1.sub4hf 1.postsub1hf)

**UNITS AND PRICES BY LABEL
esttab    label3 label2 label1 label3p label2p label1p , se star(* 0.10 ** 0.05 *** 0.01) mtitles nogaps b(%8.3f) t(%6.2f)  scalars(N ) order(1.presub3hf 1.presub2hf 1.presub1hf 1.sub1hf 1.sub2hf 1.sub3hf 1.sub4hf 1.postsub1hf) keep(1.presub3hf 1.presub2hf 1.presub1hf 1.sub1hf 1.sub2hf 1.sub3hf 1.sub4hf 1.postsub1hf) 

esttab   label3 label2 label1 label3p label2p label1p using "HU_16_label.tex" ,replace  se nostar mtitles nogaps b(%8.3f) t(%6.2f)  scalars(N ) order(1.presub3hf 1.presub2hf 1.presub1hf 1.sub1hf 1.sub2hf 1.sub3hf 1.sub4hf 1.postsub1hf) keep(1.presub3hf 1.presub2hf 1.presub1hf 1.sub1hf 1.sub2hf 1.sub3hf 1.sub4hf 1.postsub1hf) 


*log close




